POV-Ray : Newsgroups : povray.programming : max_intersections - possibility of bug ? : max_intersections - possibility of bug ? Server Time
1 Jun 2024 21:17:37 EDT (-0400)
  max_intersections - possibility of bug ?  
From: Wlodzimierz ABX Skiba
Date: 8 Jan 2001 04:39:28
Message: <3a598ad0@news.povray.org>
This weekend I had to change a little istack_struct for my patch.
Looking at function create_istack() from objects.c I have noticed
that there is pov_malloc dependant of
global setting max_intersections.
In povray 3.1 we hadn't calling to create_istack
during parsing becouse there wasn't such thing like
trace or eval_pattern{proximity pattern}.
But in mega pov and in pov 3.5 there is trace ().
Therefore such syntax can cause undefined errors:

#declare Object=csg{}
global_settings{max _intersections value}
  /* reserve first level of stack of intersections */
trace(Object,syntax_for_trace)
  /* first calling of open_istack cause allocate table of intersections */
global_settings{max _intersections more_than_previous}
  /* extend global (there is no realloc or something) */
trace(Object,syntax_for_trace)
  /* uses previous allocated table but with greater limit */

this cause that pov try write more entries to istack than is allocated

what I suggest - disable possibility of changing max intersection
after first allocation of istack

parse.c - Parse_Frame() and Parse_Global_Settings()

instead of:
  CASE (MAX_INTERSECTIONS)
    Max_Intersections = (int)Parse_Float ();
  END_CASE

should be:
  CASE (MAX_INTERSECTIONS)
    if ( free_istack != NULL )
    {
      Error("max_intersection can't be modified after first intersection
calling.");
    }
    else
    {
      Max_Intersections = (int)Parse_Float ();
    }
  END_CASE

and btw: when I set max_intersection to 1 - megapov 0.6a.win crashed

ABX


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.